#include <iostream>

/**
 * 结构体属于用户自定义的数据类型，允许用户存储不同的数据类型
 */
struct Student {
    std::string name;
    int age;
    int score;
}s3;

int main() {
    // struct 可以省略
    // 用法1
    Student s1;
    s1.name = "张三";
    s1.age = 18;
    s1.score = 100;
    std::cout << s1.name << std::endl;

    // 用法2
    struct Student s2 = {
            "李四", 19, 80
    };
    std::cout << s2.name << std::endl;

    // 用法3
    s3.name ="王武";
    std::cout << s3.name << std::endl;

    // 结构体数组
    Student stuArray[3] = {
            {"张三1", 1, 2},
            {"张三2", 1, 2},
            {"张三3", 1, 2}
    };
}